"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const csharp_1 = require("csharp");
const App = csharp_1.FairyEditor.App;
App.pluginManager.LoadUIPackage(App.pluginManager.basePath + "/" + eval("__dirname") + '/CocosInspector');
class CocosInspector extends csharp_1.FairyEditor.View.PluginInspector {
    combo;
    constructor() {
        super();
        this.panel = csharp_1.FairyGUI.UIPackage.CreateObject("CocosInspector", "WindowType").asCom;
        this.combo = this.panel.GetChild("windowType").asComboBox;
        this.combo.onChanged.Add(() => {
            let obj = App.activeDoc.inspectingTarget;
            console.log(`改变选择`);
            console.log(obj);
            console.log(obj.docElement);
            console.log(this.combo);
            console.log(this.combo.value);
            //use obj.docElement.SetProperty('xxx',..) instead of obj.xxx = ... to enable undo/redo mechanism
            try {
                obj.docElement.SetProperty("remark", this.combo.value);
            }
            catch (error) {
                console.log(error);
            }
        });
        this.updateAction = () => { return this.updateUI(); };
    }
    updateUI() {
        let sels = App.activeDoc.inspectingTargets;
        let obj = sels.get_Item(0);
        this.combo.value = obj["remark"];
        return true; //if everything is ok, return false to hide the inspector
    }
}
//Register a inspector
App.inspectorView.AddInspector(() => new CocosInspector(), "CocosInspector", "CocosInspector");
//Condition to show it
App.docFactory.ConnectInspector("CocosInspector", "mixed", true, false);
